﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using LightEffects;
using SpecialEffects;
using GlobalGameClasses;
using DrawableObjects.Actors.Aircrafts;

namespace DrawableObjects.Actors.Projectiles
{
    public class Laser : Projectile
    {
        /// <summary>
        /// this class creates the different level of weapons of the weaponsystem "plasma"
        /// it also creates laser of the boss
        /// </summary>
        private Color color
        {
            get;
            set;
        }

        private Laser(float speed, int baseDamage, string strTextureModel, Matrix worldMatrix, float scaleFactor, float boundingFactor, string explosionSound)
            : base(speed, baseDamage, strTextureModel, worldMatrix, scaleFactor, boundingFactor, explosionSound)
        {
            this.strTextureModel = strTextureModel;
        }

        public static Laser GET_LASER_LEVEl1()
        {            
            Laser laser = new Laser(3.3f, 15, "laser_player1", Matrix.CreateWorld(new Vector3(0, GlobalGameValues.GAMEFIELD_HEIGHT, 0), Vector3.Backward, Vector3.Up), 0.08f, 1, "missileExplosion");
            PointLight light = PointLight.getPointLight(new Color(255,0,0), laser);
            laser.light = light;
            return laser;
        }

        public static Laser GET_LASER_LEVEl2()
        {
            Laser laser = new Laser(3.7f, 20, "laser_player3", Matrix.CreateWorld(new Vector3(0, GlobalGameValues.GAMEFIELD_HEIGHT, 0), Vector3.Backward, Vector3.Up), 0.08f, 1, "missileExplosion");
            PointLight light = PointLight.getPointLight(new Color(50, 50, 255), laser);
            laser.light = light;
            return laser;
        }

        public static Laser GET_LASER_LEVEl3()
        {
            Laser laser = new Laser(4.1f, 25, "laser_player2", Matrix.CreateWorld(new Vector3(0, GlobalGameValues.GAMEFIELD_HEIGHT, 0), Vector3.Backward, Vector3.Up), 0.08f, 1, "missileExplosion");
            PointLight light = PointLight.getPointLight(new Color(140, 255, 140), laser);
            laser.light = light;
            return laser;
        }

        public static Laser GET_LASER_BOSS()
        {
            Laser laser = new Laser(3.0f, 3, "laser_player2", Matrix.CreateWorld(new Vector3(0, GlobalGameValues.GAMEFIELD_HEIGHT, 0), Vector3.Backward, Vector3.Up), 0.08f, 1, "missileExplosion");
            PointLight light = PointLight.getPointLight(new Color(155, 155, 255), laser);
            laser.light = light;
            return laser;
        }

        public override void collide(Actor actor2)
        {
            base.collide(actor2);
            if (actor2.owner != this.owner && actor2 is Aircraft)
            {
                world.addSpecialEffect(BasicExplosion.CreateSmokeExpl_Weapon(worldMatrix.Translation, Vector3.Zero, (float)GlobalGameValues.Values.gameTime.TotalGameTime.TotalMilliseconds));
                world.addSpecialEffect(BasicExplosion.CreateExpl_Laser(worldMatrix.Translation, Vector3.Zero, (float)GlobalGameValues.Values.gameTime.TotalGameTime.TotalMilliseconds));
            }
        }

        public override Projectile Clone(Vector2 position, Vector2 direction)
        {
            Matrix newMatrix = this.worldMatrix;
            newMatrix.M41 = position.X;
            newMatrix.M43 = position.Y;
            Laser cloned = new Laser(this.speed, this.baseDamage, this.strTextureModel, newMatrix, this.scaleFactor, this.boundingSphereFactor, this.explosionSound);
            cloned.direction = direction;
            cloned.standardRotation = this.standardRotation;
            return cloned;
        }

    }
}

